package com.huping.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface TcMapper {

    @Select("select count(*) from tc where course_id = #{courseId} and teacher_id = #{teacherId}")
    public long checkCourseExist(String courseId,String teacherId);

    @Insert("insert into tc (teacher_id, course_id) values (#{userid}, #{courseId})")
    public int tcInsert(String userid, String courseId);

    @Select("select course.course_id,name from tc,course where tc.teacher_id=#{userid} and tc.course_id=course.course_id ")
    List<Map<String, Object>> teacherSelectAllCourse(String userid);
}
